const express = require('express')
const cors = require('cors')
const serve = express()
const router = require('./router/index.js')
const bodyParser = require('body-parser')
//跨域
serve.use(cors())
//解析post的请求体
serve.use(bodyParser.urlencoded({ extended: true }))
serve.use(bodyParser.json())
//设置静态资源目录
serve.use( express.static('public'))
//设置请求接口路由
serve.use('/api', router)
//监听8888端口
serve.listen(8888, () => {
    console.log("8888端口服务器启动成功");
})